﻿#region Copyright (C) Sector7 Software Studio. All rights reserved
/*******************************************************************************************
 * Creation
 *      Author:         Wolf Lai
 *      Date:           2012/4/23 22:20:30
 *      Version:        
 * Modification 
 *      Author: 
 *      Date: 
 *      Description: 
 *      Version:
 *******************************************************************************************/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sector7.Framework.Core;
using System.Data.SqlClient;
using System.Data;
using Sector7.Framework.DB;

namespace Sector7.Restaurant.DAO.OleDB
{
    /// <summary>
    /// 流水号种子数据访问对象
    /// </summary>
    public class SeedDAO : ISeedDAO
    {
        #region Public functions
        public int Read(string tableName)
        {
            using (DBHelper opt = new DBHelper())
            {
                string storedProcedureName = "RP_GetSeed";

                SqlParameter seed = DBUtil.CreateDirectionParameter("@ReturnValue", DbType.Int32, ParameterDirection.ReturnValue);
                opt.ExecuteStoredProcedureNonQuery(
                    storedProcedureName,
                    DBUtil.CreateSqlParameter(tableName, "TableName"),
                    seed);

                return Convert.ToInt32(seed.Value);
            }
        }
        #endregion
    }
}
